#include "ftctest.h"
#include "ftc/ftc.h"
#include <iostream>

FtcTest::FtcTest(QObject* parent)
{
}
FtcTest::~FtcTest()
{
}
void FtcTest::initTestCase()
{
	std::cout << "CLASS:FtcTest START" << std::endl;
	Ftc::setRootUrl("http://192.168.6.89/fs");
}
void FtcTest::tstDownloadFile()
{
	const FtcDownloadFileInfo info = Ftc::downloadFile("4b2aabec82f34654a56421728c12f721", "D:\\test\\a123.zip");
	std::cout << "tstDownloadFile:flag=" << static_cast<int>(info.flag()) << ",errMsg=" << info.errMsg().toStdString() << std::endl;
	QString fileFullName = "D:\\test\\a456";
	const FtcDownloadFileInfo info2 = Ftc::downloadFileAutoExt("4b2aabec82f34654a56421728c12f721", fileFullName);
	std::cout << "tstDownloadFile:flag=" << static_cast<int>(info2.flag()) << ",errMsg=" << info2.errMsg().toStdString() << std::endl;
	if(info2.flag() == FtcResultFlag::Success)
	{
		std::cout << "tstDownloadFile:fileFullName=" << fileFullName.toStdString() << std::endl;
	}
}
void FtcTest::cleanupTestCase()
{
	std::cout << "CLASS:FtcTest END" << std::endl;
}

int main(int argc, char** argv)
{
	FtcTest ftc;
	return QTest::qExec(&ftc, argc, argv);// qExec 会把失败信息打印到 stdout
}